﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="CloudMLDemo.Controllers" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<% var controller = ViewContext.Controller as HomeController; %>
<head runat="server">
    <title>Score Preview</title>
</head>
<body>
    <p>First <% Response.Write(controller.DataTable.Rows.Count()); %> records from your query:</p>

    <table>
        <tr>
            <%
                foreach (var column in controller.DataTable.ColumnNames)
                {

                    Response.Write(@"<th>");
                    Response.Write(column);
                    Response.Write(@"</th>");
                }
            %>
        </tr>

        <%
            foreach (var row in controller.DataTable.Rows)
            {
                Response.Write("<tr>");
                foreach (var entry in row)
                {
                    Response.Write("<td>");
                    Response.Write(entry);
                    Response.Write("</td>");
                }
                Response.Write("</tr>");
            }
        %>
    </table>

    <form method="POST" action="/Home/RunJob">
        <input type="hidden" name="SqlConnectionString" value="<% Response.Write(this.ViewData["SqlConnectionString"]);%>">
        <input type="hidden" name="Query" value="<% Response.Write(this.ViewData["Query"]);%>">
        <input type="hidden" name="WSEndpoint" value="<% Response.Write(controller.WebServiceEndPoint);%>">
         <input type="hidden" name="WSKey" value="<% Response.Write(controller.WebServiceKey);%>">
        <input type="submit" value="Submit Job">
    </form>
</body>
</html>
